package droid.insane.GUI;

import droid.insane.logic.R;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

/**
 * @author Sandamal
 *The tabhost that holds all the other activities
 */
public class MainWindow extends TabActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tabhost);

		/*
		 * code taken from
		 * http://developer.android.com/resources/tutorials/views
		 * /hello-tabwidget.html
		 */
		Resources res = getResources();
		TabHost tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec; // Reusable TabSpec for each tab
		Intent intent; // Reusable Intent for each tab

		// Create an Intent to launch an Activity for the top ten tab
		intent = new Intent().setClass(this, TopTenWindow.class);

		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost
				.newTabSpec("topten")
				.setIndicator("Top Stocks",
						res.getDrawable(R.drawable.ic_tab_topten))
				.setContent(intent);
		tabHost.addTab(spec);

		intent = new Intent().setClass(this, MarketDataWindow.class);
		spec = tabHost
				.newTabSpec("allstocks")
				.setIndicator("Stocks",
						res.getDrawable(R.drawable.ic_tab_market))
				.setContent(intent);
		tabHost.addTab(spec);

		intent = new Intent().setClass(this, PortfolioWindow.class);
		spec = tabHost
				.newTabSpec("portfolio")
				.setIndicator("Portfolio",
						res.getDrawable(R.drawable.ic_tab_portfolio))
				.setContent(intent);
		tabHost.addTab(spec);

		tabHost.setCurrentTab(0);
	}
}
